// 该文件暴露trademark接口的方法
import request from "@/utils/request";
import { trademarkResponseData, trademark } from "./type";
enum API {
  // 获取分页列表接口
  TRADEMARK_URL = "/admin/product/baseTrademark/",
  // 新增trademark接口
  SAVETRADEMARK_URL = "/admin/product/baseTrademark/save",
  // 修改trademark接口
  UPDATETRADEMARK_URL = "/admin/product/baseTrademark/update",
  // 删除trademark的接口
  DELETETRADEMARK_URL = "/admin/product/baseTrademark/remove/",
}
export const reqTrademarkList = (page: number, limit: number) =>
  request.get<any, trademarkResponseData>(
    API.TRADEMARK_URL + `${page}/${limit}`
  );

export const reqSaveOrUpdateTrademark = (data: trademark) => {
  // 修改trademark
  if (data.id) {
    return request.put<any, any>(API.UPDATETRADEMARK_URL, data);
  } else {
    // 新增trademark
    return request.post<any, any>(API.SAVETRADEMARK_URL, data);
  }
};

export const reqDeleteTrademark = (id: number) =>
  request.delete<any, any>(API.DELETETRADEMARK_URL + id);
